//
//  SYDownloadWorking.h
//  wuyeyu
//
//  Created by shuyang on 2018/11/6.
//  Copyright © 2018年 wuyewl. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^DownloadComplete)(NSData *data, NSError *error);
typedef void(^DownloadProgress)(double progress, NSInteger downloadLength, NSInteger totleLength);

@interface SYDownloadWorking : NSObject

- (instancetype)initDownloadFileWithFileUrl:(NSString*)requestURL fileName:(NSString *)fileName;

@property (nonatomic, copy) DownloadProgress progressBlock;
@property (nonatomic, copy) DownloadComplete completeBlock;

// 下载暂停
- (void)downLoadPause;
// 下载继续
- (void)downLoadResume;
// 关闭下载
- (void)downLoadCancel;

//根据文件名获取文件地址
+ (NSString *)getLocalFilePathWithFileName:(NSString *)fileName;

//根据文件名判断是否已经保存到本地了
+ (BOOL)isSavedFileToLocalWithFileName:(NSString *)fileName;

//根据文件名保存到本地
+ (BOOL)savedFileToLocalWithFileName:(NSString *)fileName data:(NSData *)data;

//根据文件名删除本地文件
+ (BOOL)deleteFileName:(NSString *)fileName;


@end

NS_ASSUME_NONNULL_END
